import { Injectable } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';

@Injectable({
  providedIn: 'root',
})
export class ComputerConfigService {
  constructor(private fb: FormBuilder) { }

  computerConfigForm() {
    return this.fb.group({
      iptables: this.fb.group({
        content: [''],
      }),
      screensaver: this.fb.group({
        enable: [false],
        delay: [0],
        // screensaver_file_path: ['']
      }),
      screensaver_file_path: this.fb.group({
        name: [''],
        content: [''],
        upload_at: [''],
      }),
      power: this.fb.group({
        display_standby: [0],
      }),
      pam_cracklib: this.fb.group({
        minlen: [16],
        reject_username: [false],
        minclass: [0],
        pwd_policy_switch: [0]
      }),
      wallpaper: this.fb.group({
        image: ['', Validators.required],
      }),
      script: this.fb.group({
        name: [''],
        content: [''],
        upload_at: [''],
      }),
      clock_sync_config: this.fb.group({
        sync_switch: [false],
        checked_period: [],
        checked_period_unit: [],
        ntp_server: ['']
      }),
    });
  }
}
